<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>盒子模型的理解</title>
  <style>
    body,html {
      margin: 0;
      padding: 0;
    }
    .box {
      width: 300px;
      height: 200px;
      background-color: green;
    }
    .item-top {
      height: 20px;
      background-color: yellow;
    }

    .item-bottom {
      height: 20px;
      background-color: red;
    }
    .span-content {
      width: 60px; /*行内元素设置宽高无效, 其宽高由内容决定，一般是由字体宽高决定*/
      height: 60px;
      margin: 10px 20px 30px 40px; /*行内元素左右外边距有效, 上下外边距无效，不占据空间*/
      padding: 10px 20px 30px 40px; /*行内元素左右内边距有效，上下内边距无效*，不占据空间*/
      background-color: blue;
      font-size: 16px;
    }
  </style>
</head>
<body>
  <div class="box">
    <div class="item-top">上</div>
    <div>
      <span>左</span>
      <span class="span-content">span内容</span>
      <span>右</span>
    </div>
    <div class="item-bottom">下</div>
  </div>
</body>
</html>